<?php

#Registration of new user
$register = $_POST['register'];
$currName = $_POST['currName'];
$uName = $_POST['uName'];
$password = md5($_POST['password']);
$confPass = md5($_POST['confPass']);


#Editing already existing user
$change = $_POST['change'];

$name = $_POST['name'];
$Old_uName = $_POST['Old_uName'];
$OldPass = md5($_POST['OldPass']);
$newPass = md5($_POST['newPass']);
$confNew_Pass = md5($_POST['confNew_Pass']);

$changeUP = $_POST['changeUP'];

if(isset($register)){
 
$in = mysql_query("INSERT INTO user VALUES($currName, $uName, $password)") or die(mysql_error());

if($in){
$msg = "Registration successful!!";
header("location: adminPage.php?poll=$msg");
}
else {
$msg = "Registration Failed, please try again!!";
header("location: adminPage.php?poll=$msg");
}

}

if(isset($changeUP)){


//ucfirst($foo);

// ucfirst(strtolower($bar));

# strtolower()
# strtoupper() 

$sql = mysql_query("SELECT * FROM user " ."WHERE UserName='".$Old_uName."' AND Password='".$OldPass. "' ") or die(mysql_error());
$mm = mysql_fetch_array($sql) or die(mysql_error());




}



?>